#ifndef EVHTTPADAPTER_H
#define EVHTTPADAPTER_H

#include <As/Http/AbstractHttpAdapter.h>
#include <evhttp.h>
#include <As/Http/HttpResponse.h>

namespace As {

class EvHttpAdapter : public AbstractHttpAdapter {
	Q_OBJECT;
public:
	EvHttpAdapter(const QString & host, int port, bool startListen = true,
		      QObject *parent = 0);
	~EvHttpAdapter();

public slots:
	void listen();
	void stopListen();
        void response(As::HttpResponse resp);

private:
        void evhttp_callback(evhttp_request *req, void*);

private:
	QString m_host;
	int m_port;
	event_base * m_ev_base;
	evhttp * m_ev_http;
};

}

#endif // EVHTTPADAPTER_H
